package com.dapeng.cleardatabackend.exception;

import com.dapeng.cleardatabackend.common.ErrorCode;
import lombok.Getter;

/**
 * @author dapeng
 * @description 自定义业务异常
 * @date 2023/11/12 19:50
 */
@Getter
public class BusinessException extends RuntimeException {

    private final int code;


    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }

    public BusinessException(ErrorCode errorCode, String message) {
        super(message);
        this.code = errorCode.getCode();
    }

}
